package com.gyg.controller;

import com.gyg.pojo.User;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class HelloController {

    @GetMapping("/hello")
    public String hello(){
        return "hello,Swagger!";
    }


    /**
     * 返回用户的实体类
     * 只要我们的接口中，返回值中存在实体类，他就会扫描到swagger中
     * @return
     */
    @PostMapping("/user")
    public User user(){
        return new User();
    }


    //给方法增加注释
    @ApiOperation("hello2控制方法")
    @GetMapping("/hello2")
    public String hello2(@ApiParam("用户名") String username){
        return "Hello," +6+ username;
    }

}
